<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户登录 - SSO 统一认证平台</title>
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        :root {
            --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            --glass-bg: rgba(255, 255, 255, 0.12);
            --glass-border: rgba(255, 255, 255, 0.18);
            --text-primary: #ffffff;
            --text-secondary: rgba(255, 255, 255, 0.8);
            --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
        }
        
        body {
            font-family: 'Inter', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
            background: linear-gradient(135deg, #1e3c72 0%, #2a5298 25%, #667eea 50%, #764ba2 75%, #f093fb 100%);
            background-size: 400% 400%;
            animation: gradientFlow 20s ease infinite;
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            overflow: hidden;
        }
        
        body::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: 
                radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
            pointer-events: none;
        }
        
        @keyframes gradientFlow {
            0%, 100% { background-position: 0% 50%; }
            25% { background-position: 100% 50%; }
            50% { background-position: 100% 100%; }
            75% { background-position: 0% 100%; }
        }
        
        .login-container {
            background: var(--glass-bg);
            backdrop-filter: blur(20px) saturate(180%);
            border: 1px solid var(--glass-border);
            border-radius: 32px;
            box-shadow: 
                var(--shadow-xl),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
            padding: 60px 50px;
            max-width: 520px;
            width: 90%;
            text-align: center;
            position: relative;
            z-index: 1;
            animation: fadeInUp 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        }
        
        .login-container::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            border-radius: 32px;
            padding: 1px;
            background: linear-gradient(135deg, rgba(255,255,255,0.3), rgba(255,255,255,0.1));
            mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
            mask-composite: xor;
            pointer-events: none;
        }
        
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(40px) scale(0.95);
            }
            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }
        
        .logo {
            font-size: 5rem;
            margin-bottom: 24px;
            position: relative;
            display: inline-block;
            filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3));
            animation: logoFloat 3s ease-in-out infinite;
        }
        
        @keyframes logoFloat {
            0%, 100% { transform: translateY(0px); }
            50% { transform: translateY(-8px); }
        }
        
        h1 {
            color: var(--text-primary);
            margin-bottom: 12px;
            font-size: 3rem;
            font-weight: 800;
            letter-spacing: -0.03em;
            text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
            background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        
        .subtitle {
            color: var(--text-secondary);
            margin-bottom: 48px;
            font-size: 1.2rem;
            font-weight: 400;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        }
        
        .form-group {
            margin-bottom: 28px;
            text-align: left;
        }
        
        label {
            display: block;
            color: var(--text-primary);
            margin-bottom: 10px;
            font-weight: 600;
            font-size: 0.9rem;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
        }
        
        .input-wrapper {
            position: relative;
        }
        
        input[type="text"], input[type="password"] {
            width: 100%;
            padding: 18px 24px;
            border: 2px solid rgba(255, 255, 255, 0.2);
            border-radius: 16px;
            font-size: 1.1rem;
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            color: var(--text-primary);
            box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
        }
        
        input[type="text"]:focus, input[type="password"]:focus {
            outline: none;
            border-color: rgba(255, 255, 255, 0.5);
            background: rgba(255, 255, 255, 0.15);
            box-shadow: 
                0 0 0 4px rgba(255, 255, 255, 0.1),
                inset 0 2px 4px rgba(0, 0, 0, 0.1),
                0 8px 16px rgba(0, 0, 0, 0.15);
            transform: translateY(-2px);
        }
        
        input::placeholder {
            color: rgba(255, 255, 255, 0.6);
        }
        
        .btn-login {
            width: 100%;
            padding: 20px 32px;
            background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
            color: #1e293b;
            border: none;
            border-radius: 16px;
            font-size: 1.2rem;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            margin-bottom: 40px;
            box-shadow: 
                0 8px 16px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.6);
            position: relative;
            overflow: hidden;
        }
        
        .btn-login::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
            transition: left 0.6s;
        }
        
        .btn-login:hover::before {
            left: 100%;
        }
        
        .btn-login:hover {
            transform: translateY(-3px) scale(1.02);
            box-shadow: 
                0 16px 32px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
        }
        
        .btn-login:active {
            transform: translateY(-1px) scale(1.01);
        }
        
        .error-message {
            background: rgba(239, 68, 68, 0.1);
            backdrop-filter: blur(10px);
            color: #ffffff;
            padding: 18px 24px;
            border-radius: 16px;
            margin-bottom: 28px;
            border: 1px solid rgba(239, 68, 68, 0.3);
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 12px;
            box-shadow: 0 8px 16px rgba(239, 68, 68, 0.2);
            animation: shake 0.5s ease-in-out;
        }
        
        @keyframes shake {
            0%, 100% { transform: translateX(0); }
            25% { transform: translateX(-4px); }
            75% { transform: translateX(4px); }
        }
        
        .success-message {
            background: rgba(34, 197, 94, 0.1);
            backdrop-filter: blur(10px);
            color: #ffffff;
            padding: 18px 24px;
            border-radius: 16px;
            margin-bottom: 28px;
            border: 1px solid rgba(34, 197, 94, 0.3);
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 12px;
            box-shadow: 0 8px 16px rgba(34, 197, 94, 0.2);
            animation: slideDown 0.6s ease-out;
        }
        
        @keyframes slideDown {
            from {
                opacity: 0;
                transform: translateY(-20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .test-accounts {
            background: rgba(255, 255, 255, 0.08);
            backdrop-filter: blur(15px);
            padding: 32px;
            border-radius: 24px;
            margin-top: 40px;
            text-align: left;
            border: 1px solid rgba(255, 255, 255, 0.15);
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
        }
        
        .test-accounts h4 {
            color: var(--text-primary);
            margin-bottom: 24px;
            text-align: center;
            font-weight: 700;
            font-size: 1.1rem;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        }
        
        .account-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 20px;
            background: rgba(255, 255, 255, 0.05);
            backdrop-filter: blur(10px);
            border-radius: 12px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            margin-bottom: 12px;
            position: relative;
            overflow: hidden;
        }
        
        .account-item::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
            transition: left 0.6s;
        }
        
        .account-item:hover::before {
            left: 100%;
        }
        
        .account-item:hover {
            border-color: rgba(255, 255, 255, 0.3);
            background: rgba(255, 255, 255, 0.1);
            transform: translateX(8px) scale(1.02);
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
        }
        
        .account-role {
            font-weight: 600;
            color: var(--text-primary);
            font-size: 0.95rem;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
        }
        
        .account-credentials {
            color: var(--text-secondary);
            font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
            font-size: 0.9rem;
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(5px);
            padding: 8px 12px;
            border-radius: 8px;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }
        
        .footer {
            margin-top: 40px;
            color: var(--text-secondary);
            font-size: 0.9rem;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
        }
        
        .footer p:first-child {
            font-weight: 600;
            margin-bottom: 4px;
        }
        
        @media (max-width: 640px) {
            .login-container {
                padding: 32px 24px;
                margin: 16px;
            }
            h1 { font-size: 2rem; }
            .logo { font-size: 3rem; }
        }
    </style>
</head>
<body>
    <div class="login-container">
        <div class="logo">🔐</div>
        <h1>用户登录</h1>
        <p class="subtitle">SSO 统一认证平台</p>
        
        <!-- 错误信息显示 -->
        <div th:if="${param.error}" class="error-message">
            <span>⚠️</span>
            <div>
                <strong>登录失败！</strong><br>
                用户名或密码错误，请重试。
            </div>
        </div>
        
        <div th:if="${param.logout}" class="success-message">
            <span>✓</span>
            <div>
                <strong>退出成功！</strong><br>
                您已安全退出系统。
            </div>
        </div>
        
        <!-- 登录表单 -->
        <form th:action="@{/login}" method="post">
            <div class="form-group">
                <label for="username">用户名</label>
                <input type="text" id="username" name="username" required 
                       placeholder="请输入用户名" autocomplete="username">
            </div>
            
            <div class="form-group">
                <label for="password">密码</label>
                <input type="password" id="password" name="password" required 
                       placeholder="请输入密码" autocomplete="current-password">
            </div>
            
            <button type="submit" class="btn-login">立即登录</button>
        </form>
        
        <!-- 测试账号信息 -->
        <div class="test-accounts">
            <h4>🧪 测试账号</h4>
            <div class="account-item" data-username="admin" data-password="123456">
                <span class="account-role">👑 管理员</span>
                <span class="account-credentials">admin / 123456</span>
            </div>
            <div class="account-item" data-username="oa_user" data-password="123456">
                <span class="account-role">🏢 OA用户</span>
                <span class="account-credentials">oa_user / 123456</span>
            </div>
            <div class="account-item" data-username="risk_user" data-password="123456">
                <span class="account-role">🛡️ 风控专员</span>
                <span class="account-credentials">risk_user / 123456</span>
            </div>
            <div class="account-item" data-username="user" data-password="123456">
                <span class="account-role">👤 普通用户</span>
                <span class="account-credentials">user / 123456</span>
            </div>
        </div>
        
        <div class="footer">
            <p>Spring Boot 3 + OAuth2 + JWT</p>
            <p>统一身份认证与单点登录系统</p>
        </div>
    </div>
    
    <script>
        // 自动聚焦到用户名输入框
        document.addEventListener('DOMContentLoaded', function() {
            document.getElementById('username').focus();
        });
        
        // 快速填充测试账号（打字机效果）
        function fillAccount(username, password) {
            const usernameInput = document.getElementById('username');
            const passwordInput = document.getElementById('password');
            
            usernameInput.value = '';
            passwordInput.value = '';
            
            // 打字机效果
            typeWriter(usernameInput, username, 50, () => {
                typeWriter(passwordInput, password, 50);
            });
        }
        
        function typeWriter(element, text, speed, callback) {
            let i = 0;
            function type() {
                if (i < text.length) {
                    element.value += text.charAt(i);
                    i++;
                    setTimeout(type, speed);
                } else if (callback) {
                    setTimeout(callback, 200);
                }
            }
            type();
        }
        
        // 为测试账号添加点击事件
        document.querySelectorAll('.account-item').forEach(item => {
            item.addEventListener('click', function() {
                const username = this.getAttribute('data-username');
                const password = this.getAttribute('data-password');
                fillAccount(username, password);
                
                // 添加视觉反馈
                this.style.transform = 'scale(0.98)';
                setTimeout(() => {
                    this.style.transform = '';
                }, 150);
            });
        });
        
        // 表单提交动画
        document.querySelector('form').addEventListener('submit', function(e) {
            const submitBtn = document.querySelector('.btn-login');
            submitBtn.innerHTML = '🔄 登录中...';
            submitBtn.style.opacity = '0.8';
        });
    </script>
</body>
</html> 